package item10;

public class Duotai {
	private Duotai[] duotais = new Duotai[6];
	private int nexIndex = 0;

	public void draw(Duotai duotai) {
		if (nexIndex < duotais.length) {
			duotais[nexIndex] = duotai;
			System.out.println(nexIndex);
			nexIndex++;
		}
	}

	public static void main(String[] args) {
		Duotai duotai = new Duotai();
		duotai.draw(new lei1());
		duotai.draw(new lei2());
	}

}

class lei1 extends Duotai {
	public lei1() {
		System.out.println("lei 1");
	}
}

class lei2 extends Duotai {
	public lei2() {
		System.out.println("lei 2");
	}
}
